home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
keypres2.zip
/
KEYPRESS.DOC
< prev
Wrap
Text File
|
1987-11-14
|
2KB
|
60 lines
KEYPRESS
A utility to be used in batch files to intercept and use keystrokes.
Note that the "IF ERROR LEVEL" statements must be in descending order,
with Exit being the last (or zero error level).
This program was originally written by "lew w." (whoever that is).
Regrettably, no further information on source or author is available.
I used ASMGEN to disassemble the original .COM file and commented the
generated source .ASM file for your edification. Also tweaked it
a wee little bit.
DOKEY.BAT is my demo .BAT file to demonstrate KEYPRESS. The original
KEYPRESS.DOC (from "lew m.", below) is another demonstration.
You should be able to present menu choices from A to Z (and maybe even
single numeric key entries as well). Just be sure to get your error
levels in the correct (reverse) order, and that the suggested key entries
on your menu correspond to the results desired.
Naturally, as in any batch file, any legal DOS command can be produced from
a single key stroke. Using a multiple command interpreter, such as the
public domain DO.COM, you could even send multiple commands to DOS.
Watch it on nesting other .BAT files, however. Strange and wondrous things
can result.
David Kirschbaum
Toad Hall
kirsch@braggvax.ARPA
The original KEYPRESS.DOC follows:
THIS FILE IS USED IN BATCH FILES TO INTERCEPT AND UTILIZE KEYSTROKES
AN EXAMPLE BATCH FILE IS SHOWN BELOW
NOTE THAT THE "IF ERROR LEVEL " STATEMENTS MUST BE IN DESCENDING ORDER
WITH exit being the last, or zero error level
good luck, lew w.
ECHO OFF
:QUERY
ECHO PRESS A OR B OR C
ECHO A=1DIRPLUS
ECHO B=PC-WRITE
ECHO C=THIS FILE
KEYPRESS A B C
if errorlevel 3 goto c
if errorlevel 2 goto b
if errorlevel 1 goto a
ECHO TRY AGAIN
GOTO QUERY
:a
1DIR
:b
CD\PCW
ED
:c
GO
:exit